<!DOCTYPE html>
<html>
<head>
<title>商品详情</title>
<?php $this->load->view('common/include');?>
<style>
.bo-checked-addon:before {
  position: absolute;
  right: -8px;
  top: -3.2px;
  font-family: iconfont;
  content: '\e628';
  font-size: 16px;
  color: #999;
}

textarea{
	border:0;
	width: 100%;
	padding:15px;
}
#commentt{
	position: fixed;
	bottom:0;
	width:100%;
	background: #f2f2f2;
	z-index:9999999;
	min-height: 240px;
	padding:10px;
	border-top:1px #ccc solid;
}

.type{
	padding-bottom:200px !important;
}

.nt{

  float:left;
  width: 120px;
}
.np{

  float:left;
}
</style>
</head>
<body id="app" v-cloak>
	<header-layout title='' pos="absolute" type="tran">
		<header-dock align='left'>
			<a href="<?php echo site_url('/home'); ?>"><Icon type="back"></Icon></a>
		</header-dock>
		商品详情
		<header-dock align='right'>
			<a href="<?php echo site_url('/user'); ?>"><icon type="people"></icon></a>
		</header-dock>
	</header-layout>
	<layout-main top="none">
		<div class="bo-banner">
			<img src="http://7xj0kd.com2.z0.glb.qiniucdn.com/<?php echo $product['image']; ?>?imageView2/1/w/360/h/240" alt="">
		</div>
		<layout-box p="1111">

			<h3><?php echo $product['name']; ?>(星期{{week[currentDay]}})</h3>
			<grid-row p="0000">
				<form-stars val=<?php echo $product['score'];?> size="sm" disable=true></form-stars>
				<div class="bo-clear"></div>
			</grid-row>
			<p style="padding:0;margin:0;"><?php echo $product['description']; ?></p>
			<grid-row p="1000">
        <!--
				<div class="product-dock">
					<div class="price" v-if="checked">
						<span><i class="icon iconfont icon-check"></i></span> 已添加
					</div>

					<div class="mount">
						<span  style="font-size:20px;padding-right:20px;color:#999">
							<a @click="gocomment" style="color:#999;"><i class="icon iconfont icon-comment"></i></a>
						</span>
						<form-check @check-click="buy" :checked.sync="checked" v-ref:check></form-check>
					</div>
				</div>
				<div class="bo-clear"></div>-->
			</grid-row>

		</layout-box>
		<h3 class="bo-box-title">商品配料</h3>
		<layout-box p="0110">
			<grid-row>
			<?php foreach ($materials as $item): ?>
				<grid-col size="6" p="1001">
					<div class="nutri"  >

						<div class="pic" style="border-radius:19px;background:#f2f2f2;line-height:38px;text-align:center;color:#999">
              <?=mb_substr($item['name'],0,1,'utf-8')?>
						</div>
						<h3><?php echo $item['name']; ?></h3>
						<p><?php echo $item['amount'].'克'; ?></p>
					</div>
				</grid-col>
			<?php endforeach; ?>
			</grid-row>
		</layout-box>

		<h3 class="bo-box-title">营养成分</h3>
		<layout-box p="0110">
			<grid-row>
				<grid-col size="12" p="1001">
					<span class="nt">热量</span> <span class="np"><?=number_format($nutrient['nengliang'],2,".","");?>千卡</span><br>
					<span class="nt">脂肪</span> <span class="np"><?=number_format($nutrient['zhifang'],2,".","");?>克</span><br>
					<span class="nt">蛋白质</span><span class="np"><?=number_format($nutrient['danbaizhi'],2,".","");?>克</span><br>
					<span class="nt">碳水化合物</span> <span class="np"><?=number_format($nutrient['tanshui'],2,".","");?>克</span>
				</grid-col>
			</grid-row>
		</layout-box>

		<h3 class="bo-box-title">商品评价</h3>
		<list @list-scroll="loadingComments" end-msg="没有更多评论了" v-ref:comments>
			<list-item v-for="item in comments">
				<layout-box p="1111">
					<div class="bo-comment">
				 		<h3 class="name">{{item.obj.name}}</h3>
				 		<div class="info">
							<form-stars v-if="item.show" size="sm" disable=true :val="item.obj.score"></form-stars>
							{{item.obj.date}}
				 		</div>
				 		<p class="content">
				 			{{item.obj.content}}
				 		</p>
				 		<p v-if="item.obj.reply" class="reply"><span class="reply-name">回复：</span>
							{{item.obj.reply}}
				 		</p>
				 	</div>
				</layout-box>
			</list-item>
		</list>




	</layout-main>
	<div id="commentt" v-if="commentShow" class="" :class="[commentcss]">
			<textarea @focus="focuscomment"    name="" id="comment" rows="5" placeholder="请输入评价"></textarea>

		<grid-row p="1010">
			<btn type="primary" block=true @btn-click="comment" name="提交评价"></btn>
		</grid-row>
		<grid-row p="0010">
			<btn  block=true @btn-click="cancelcomment" name="取消评价"></btn>
		</grid-row>
	</div>
	<shopping-dock :total="total" @shoppingdock-go="gotoshp"></shopping-dock>
	<script>
		var PRODUCT = <?php echo json_encode($product);?>;
		var TOTAL= <?php echo $total; ?>;
		var DATE = '<?php echo $date; ?>';
		var CHECKED = <?php if($product['amount']>0){echo 'true';}else {echo 'false';} ?>

	</script>
	<script src="js/product.build.js?v=1.2.9"></script>
</body>
</html>
